package com.franklin.validation.core.support;

import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * Description : json校验组件扫描器
 * Create By: Franklin
 * Date : 2020/6/11 15:42
 */
public class JsonComponentPackageScanHandle extends ClassPathBeanDefinitionScanner {

    public JsonComponentPackageScanHandle(BeanDefinitionRegistry registry, boolean useDefaultFilters) {
        super(registry, useDefaultFilters);
    }

    @Override
    protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
        super.addIncludeFilter(new AnnotationTypeFilter(Component.class));
        return super.doScan(basePackages);
    }
}
